The Spring Framework - Reference Documentation

Total Page:16

File Type:pdf, Size:1020Kb

The Spring Framework - Reference Documentation The Spring Framework - Reference Documentation Version 2.5.6 Copyright © 2004-2008 Rod Johnson, Juergen Hoeller, Alef Arendsen, Colin Sampaleanu, Rob Harrop, Thomas Risberg, Darren Davison, Dmitriy Kopylenko, Mark Pollack, Thierry Templier, Erwin Vervaet, Portia Tung, Ben Hale, Adrian Colyer, John Lewis, Costin Leau, Mark Fisher, Sam Brannen, Ramnivas Laddad, Arjen Poutsma Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether distributed in print or electronically. Preface................................................................................................................................................xv 1.Introduction...................................................................................................................................16 1.1.Overview..............................................................................................................................16 1.2.Usagescenarios ....................................................................................................................18 2. What's new in Spring 2.0 and 2.5? ................................................................................................. 21 2.1.Introduction ..........................................................................................................................21 2.2. The Inversion of Control (IoC) container ................................................................................ 21 2.2.1.Newbeanscopes ........................................................................................................21 2.2.2.EasierXMLconfiguration...........................................................................................22 2.2.3.ExtensibleXMLauthoring ..........................................................................................22 2.2.4.Annotation-drivenconfiguration..................................................................................22 2.2.5.Autodetectingcomponentsintheclasspath .................................................................. 22 2.3.AspectOrientedProgramming(AOP) ....................................................................................23 2.3.1.EasierAOPXMLconfiguration ..................................................................................23 2.3.2.Supportfor@AspectJaspects .....................................................................................23 2.3.3. Support for bean name pointcut element ...................................................................... 23 2.3.4.SupportforAspectJload-timeweaving ........................................................................ 23 2.4.TheMiddleTier ....................................................................................................................23 2.4.1. Easier configuration of declarative transactions in XML ............................................... 23 2.4.2.FullWebSpheretransactionmanagementsupport ......................................................... 24 2.4.3.JPA ...........................................................................................................................24 2.4.4.AsynchronousJMS.....................................................................................................24 2.4.5.JDBC ........................................................................................................................24 2.5.TheWebTier........................................................................................................................25 2.5.1.SensibledefaultinginSpringMVC ............................................................................. 25 2.5.2.Portletframework.......................................................................................................25 2.5.3.Annotation-basedcontrollers.......................................................................................25 2.5.4. A form tag library for Spring MVC ............................................................................. 25 2.5.5.Tiles2support ...........................................................................................................25 2.5.6.JSF1.2support ..........................................................................................................26 2.5.7.JAX-WSsupport ........................................................................................................26 2.6.Everythingelse .....................................................................................................................26 2.6.1.Dynamiclanguagesupport ..........................................................................................26 2.6.2.Enhancedtestingsupport ............................................................................................26 2.6.3.JMXsupport ..............................................................................................................26 2.6.4. Deploying a Spring application context as JCA adapter ................................................. 27 2.6.5.Taskscheduling .........................................................................................................27 2.6.6.Java5(Tiger)support .................................................................................................27 2.7.MigratingtoSpring2.5..........................................................................................................27 2.7.1.Changes.....................................................................................................................28 2.8.Updatedsampleapplications ..................................................................................................30 2.9.Improveddocumentation .......................................................................................................30 I.CoreTechnologies............................................................................................................................31 3.TheIoCcontainer ..................................................................................................................32 3.1.Introduction ..................................................................................................................32 3.2.Basics-containersandbeans ......................................................................................... 32 3.2.1.Thecontainer .....................................................................................................33 3.2.2.Instantiatingacontainer ......................................................................................34 3.2.3.Thebeans ..........................................................................................................35 3.2.4.Usingthecontainer .............................................................................................39 3.3.Dependencies................................................................................................................40 3.3.1.Injectingdependencies........................................................................................40 Spring Framework (2.5.6) ii The Spring Framework - Reference Documentation 3.3.2.Dependenciesandconfigurationindetail ............................................................. 45 3.3.3.Usingdepends-on ..............................................................................................54 3.3.4.Lazily-instantiatedbeans.....................................................................................54 3.3.5.Autowiringcollaborators ....................................................................................55 3.3.6.Checkingfordependencies..................................................................................57 3.3.7.MethodInjection ................................................................................................58 3.4.Beanscopes ..................................................................................................................61 3.4.1.Thesingletonscope ............................................................................................62 3.4.2.Theprototypescope ...........................................................................................63 3.4.3.Singletonbeanswithprototype-beandependencies ............................................... 64 3.4.4.Theotherscopes.................................................................................................64 3.4.5.Customscopes ...................................................................................................68 3.5. Customizing the nature of a bean .................................................................................... 70 3.5.1.Lifecyclecallbacks .............................................................................................70 3.5.2.Knowingwhoyouare .........................................................................................74 3.6.Beandefinitioninheritance ............................................................................................76 3.7.Containerextensionpoints .............................................................................................77 3.7.1.Customizingbeansusing BeanPostProcessors ....................................................78 3.7.2.Customizingconfigurationmetadatawith BeanFactoryPostProcessors ............... 80 3.7.3.Customizinginstantiationlogicusing
Recommended publications
  • Hibernate ORM Query Simplication Using Hibernate
    2016 3rd National Foundation for Science and Technology Development Conference on Information and Computer Science Hibernate ORM Query Simplication Using Hibernate Criteria Extension (HCE) Kisman Sani M. Isa Master of Information Technology Master in Computer Science Bina Nusantara University Bina Nusantara University Jl. Kebon Jeruk Raya No. 27, Jakarta Barat, DKI Jl. Kebon Jeruk Raya No. 27, Jakarta Barat, DKI Jakarta, Indonesia 11530 Jakarta, Indonesia 11530 [email protected] [email protected] Abstract— Software development time is a critical issue interfaced by a query. The software engineer will make in software development process, hibernate has been the query specified to database used. Each database widely used to increase development speed. It is used in vendor has their Structured Query Language (SQL). As database manipulation layer. This research develops a the development of software technology and most of library to simplify hibernate criteria. The library that is programming languages are object oriented, some called as Hibernate Criteria Extension (HCE) provides API functions to simplify code and easily to be used. Query engineer or software institutions try to simplify the associations can be defined by using dot. The library will query process. They try to bind object in application to automatically detect the join association(s) based on database. This approach is called as Object Relational mapping in entity class. It can also be used in restriction Mapping (ORM). ORM is a translation mechanism from and order. HCE is a hibernate wrapper library. The object to relational data, vice versa. ORM has “dialect” configuration is based on hibernate configuration.
    [Show full text]
  • Arxiv:2103.14589V2 [Math.GR] 16 Jun 2021
    FINITENESS PROPERTIES FOR RELATIVES OF BRAIDED HIGMAN–THOMPSON GROUPS RACHEL SKIPPER AND XIAOLEI WU Abstract. We study the finiteness properties of the braided Higman–Thompson group bVd,r(H) with labels in H ≤ Bd, and bFd,r(H) and bTd,r(H) with labels in H ≤ P Bd where Bd is the braid group with d strings and P Bd is its pure braid subgroup. We show that for all d ≥ 2 and r ≥ 1, the group bVd,r(H) (resp. bTd,r(H) or bFd,r(H)) is of type Fn if and only if H is. Our result in particular confirms a recent conjecture of Aroca and Cumplido. Introduction The family of Thompson’s groups and the many groups in the extended Thompson family have long been studied for their many interesting properties. Thompson’s group F is the first example of a type F∞, torsion-free group with infinite cohomological dimension [BG84] while Thompson’s groups T and V provided the first examples of finitely presented simple groups. More recently the braided and labeled braided Higman–Thompson groups have garnered attention in part due their connections with big mapping class groups. The braided version of Thompson’s group V , which we refer to here as bV , was first intro- duced independently by Brin and Dehornoy [Bri07], [Deh06]. Brady, Burillo, Cleary, and Stein introduced braided F , or bF . The groups bV and bF were shown to be finitely presented in [Bro06] and [BBCS08], respectively, and this was extended to show that both of these groups + + are of type F∞ in [BFM 16].
    [Show full text]
  • 2019 Stateof the Software Supply Chain
    2019 State of the Software Supply Chain The 5th annual report on global open source software development presented by in partnership with supported by Table of Contents Introduction................................................................................. 3 CHAPTER 4: Exemplary Dev Teams .................................26 4.1 The Enterprise Continues to Accelerate ...........................27 Infographic .................................................................................. 4 4.2 Analysis of 12,000 Large Enterprises ................................27 CHAPTER 1: Global Supply of Open Source .................5 4.3 Component Releases Make Up 85% of a Modern Application......................................... 28 1.1 Supply of Open Source is Massive ...........................................6 4.4 Characteristics of Exemplary 1.2 Supply of Open Source is Expanding Rapidly ..................7 Development Teams ................................................................... 29 1.3 Suppliers, Components and Releases ..................................7 4.5 Rewards for Exemplary Development Teams ..............34 CHAPTER 2: Global Demand for Open Source ..........8 CHAPTER 5: The Changing Landscape .......................35 2.1 Accelerating Demand for 5.1 Deming Emphasizes Building Quality In ...........................36 Open Source Libraries .....................................................................9 5.2 Tracing Vulnerable Component Release 2.2 Automated Pipelines and Downloads Across Software Supply Chains
    [Show full text]
  • K-12 Workforce Development in Transportation Engineering at FIU (2012- Task Order # 005)
    K-12 Workforce Development in Transportation Engineering at FIU (2012- Task Order # 005) 2016 Final Report K-12 Workforce Development in Transportation Engineering at FIU (2012- Task Order # 005) Berrin Tansel, Ph.D., P.E., Florida International University August 2016 1 K-12 Workforce Development in Transportation Engineering at FIU (2012- Task Order # 005) This page is intentionally left blank. i K-12 Workforce Development in Transportation Engineering at FIU (2012- Task Order # 005) U.S. DOT DISCLAIMER The contents of this report reflect the views of the authors, who are responsible for the facts, and the accuracy of the information presented herein. This document is disseminated under the sponsorship of the U.S. Department of Transportation’s University Transportation Centers Program, in the interest of information exchange. The U.S. Government assumes no liability for the contents or use thereof. ACKNOWLEDGEMENT OF SPONSORSHIP This work was sponsored by a grant from the Southeastern Transportation Research, Innovation, Development and Education Center (STRIDE) at the University of Florida. The STRIDE Center is funded through the U.S. Department of Transportation’s University Transportation Centers Program. ii K-12 Workforce Development in Transportation Engineering at FIU (2012- Task Order # 005) TABLE OF CONTENTS ABSTRACT ...................................................................................................................................................... v CHAPTER 1: INTRODUCTION ........................................................................................................................
    [Show full text]
  • Red Hat AMQ 6.1 Jboss A-MQ for Xpaas Release Notes
    Red Hat JBoss A-MQ 6.1 JBoss A-MQ for xPaaS Release Notes What's new in Red Hat JBoss A-MQ for xPaaS Last Updated: 2017-10-13 Red Hat JBoss A-MQ 6.1 JBoss A-MQ for xPaaS Release Notes What's new in Red Hat JBoss A-MQ for xPaaS JBoss A-MQ Docs Team Content Services [email protected] Legal Notice Copyright © 2014 Red Hat. The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/ . In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version. Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law. Red Hat, Red Hat Enterprise Linux, the Shadowman logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries. Linux ® is the registered trademark of Linus Torvalds in the United States and other countries. Java ® is a registered trademark of Oracle and/or its affiliates. XFS ® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries. MySQL ® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
    [Show full text]
  • J2EE Development Standards
    Indiana University J2EE Development Standards University Information Systems September 2004 Version 1.4 Table of Contents Introduction............................................................................................................... 3 Methodology..............................................................................................................6 Architecture...............................................................................................................12 Coding Conventions..................................................................................................18 Standard Libraries ....................................................................................................20 Tools ..........................................................................................................................21 Development Platform ..............................................................................................22 Shared Services .........................................................................................................23 Deployment................................................................................................................24 References and Links................................................................................................26 Appendices.................................................................................................................28 J2EE Development Standards v1.4 - 2 - J2EE Development Standards: Introduction
    [Show full text]
  • Cloud-TM Companion Document For
    Cloud-TM Specific Targeted Research Project (STReP) Contract no. 257784 Companion document for deliverable D2.2: Preliminary Prototype of the RDSTM and RSS Date of preparation: 10 June 2010 Start date of project: 1 June 2010 Duration: 36 Months Contributors Emmanuel Bernard, Red Hat Joao Cachopo, INESC-ID Mark Little, Red Hat Francesco Quaglia, CINI Paolo Romano, INESC-ID Vittorio A. Ziparo, ALGORITHMICA Manik Surtani, Red Hat Sanne Grinovero, Red Hat Fabio Cottefoglie, ALGORITHMICA —————————————————— (C) 2010 Cloud-TM Consortium. Some rights reserved. This work is licensed under the Attribution-NonCommercial-NoDerivs 3.0 Creative Commons License. See http://creativecommons.org/licenses/by-nc-nd/3.0/legalcode for details. Table of Contents 1 Introduction 4 1.1 Relationship with other deliverables . .4 2 Architectural Overview of the Cloud-TM Preliminary Prototype 6 2.1 TorqueBox . .6 2.2 Object Grid Mapper . .7 2.3 Reconfigurable Distributed STM and Storage System . .8 3 Setting up the prototype 10 3.1 Structure and Content of the Package . 10 3.2 Installing and running the prototype . 10 3.2.1 Hibernate OGM . 11 3.2.2 Fenix Framework . 12 4 Conclusions 13 3 1 Introduction This document accompanies Deliverable D2.2, Preliminary Prototype of the Cloud- TM platform. Its aim is to overview the current architecture of the prototype and to document how to set it up in order to develop applications running on top of it. As planned in the DoW this preliminary prototype does not include neither dy- namic reconfiguration mechanisms, nor the Autonomic Manager which are going to be developed later on during the project.
    [Show full text]
  • APACHE LUCENE for JAVA EE DEVELOPERS JAVAONE:2015 by @Sannegrinovero
    APACHE LUCENE FOR JAVA EE DEVELOPERS JAVAONE:2015 by @SanneGrinovero WHO AM I? WHO AM I? RED HAT Principal Software Engineer, middleware R&D Dutch, Italian, living now in London HIBERNATE TEAM Hibernate Search project lead Hibernate ORM Hibernate OGM CONTRIBUTING TO INFINISPAN the Lucene guy: Infinispan Query, Infinispan Lucene Directory, clustering extensions for Hibernate Search OTHER PROJECTS I HELP WITH... WildFly, JGroups, Apache Lucene, ... AGENDA What is Apache Lucene and how can it help you Integrations with a JPA application via Hibernate Search How does this all relate with Infinispan and WildFly Lucene index management & clouds Plans and wishlist for the future THE SEARCH PROBLEM THE SEARCH PROBLEM Hey JavaOne, remind me where the talk having primary key #2342 is? SQL CAN HANDLE TEXT SQL CAN HANDLE TEXT The LIKE operator? LET'S REFRESH SOME LESSONS ON LET'S REFRESH SOME LESSONS ON THE WIKIPEDIA Select * from WikipediaPages p where p.content LIKE ?; Select * from WikipediaPages p where p.title LIKE ?; Select * from WikipediaPages p where (lowercase(p.content) LIKE %:1% OR lowercase(p.content) LIKE %:2% OR lowercase(p.content) LIKE %:3% OR ...); HOW BAD IS IT? HOW BAD IS IT? I'm quoting successfull web companies. How many can you list which do not provide an effective search engine? Human interaction REQUIREMENTS FOR A SEARCH REQUIREMENTS FOR A SEARCH ENGINE Need to guess what you want w/o you typing all of the content Humans hate complex forms: can't you just guess what I need? We want the results in the blink of an eye We want the right result on top: Relevance We want the right result on top: Relevance SOME MORE THINGS TO CONSIDER: SOME MORE THINGS TO CONSIDER: Approximate word matches Stemming / Language specific analysis Typos Synonyms, Abbreviations, Technical Language specializations BASICS: KEYWORD EXTRACTION On how to improve running by Scott 1.
    [Show full text]
  • Spring Framework Cookbook I
    Spring Framework Cookbook i Spring Framework Cookbook Spring Framework Cookbook ii Contents 1 Spring Framework Best Practices 1 1.1 Define singleton beans with names same as their class or interface names.....................1 1.2 Place Spring bean configuration files under a folder instead of root folder.....................1 1.3 Give common prefixes or suffixes to Spring bean configuration files........................2 1.4 Avoid using import elements within Spring XML configuration files as much as possible.............2 1.5 Stay away from auto wiring in XML based bean configurations...........................2 1.6 Always externalize bean property values with property placeholders........................3 1.7 Select default version-less XSD when importing namespace definitions.......................3 1.8 Always place classpath prefix in resource paths...................................4 1.9 Create a setter method even though you use field level auto wiring.........................4 1.10 Create a separate service layer even though service methods barely delegate their responsibilities to correspond- ing DAO methods...................................................4 1.11 Use stereotype annotations as much as possible when employing annotation driven bean configuration......5 1.12 Group handler methods according to related scenarios in different Controller beans................6 1.13 Place annotations over concrete classes and their methods instead of their interfaces................6 1.14 Prefer throwing runtime exceptions instead of checked exceptions
    [Show full text]
  • Framework-Specific Modeling Languages
    Framework-Specific Modeling Languages by MichalAntkiewicz A thesis presented to the University of Waterloo in fulfillment of the thesis requirement for the degree of Doctor of Philosophy in Electrical and Computer Engineering Waterloo, Ontario, Canada, 2008 c Micha lAntkiewicz 2008 ISBN: 978-0-494-43232-7 I hereby declare that I am the sole author of this thesis. This is a true copy of the thesis, including any required final revisions, as accepted by my examiners. I understand that my thesis may be made electronically available to the public. Micha lAntkiewicz ii Abstract Framework-specific modeling languages (FSMLs) help developers build applications based on object-oriented frameworks. FSMLs formalize abstractions and rules of the framework's application programming interfaces (APIs) and can express models of how applications use an API. Such models, referred to as framework-specific models, aid developers in understanding, creating, and evolving application code. We present the concept of FSMLs, propose a way of specifying their abstract syntax and semantics, and show how such language specifications can be interpreted to provide reverse, forward, and round-trip engineering of framework-specific mod- els and framework-based application code. We present a method for engineering FSMLs that was extracted post-mortem from the experience of building four such languages. The method is driven by the use cases that the FSMLs under development are to support. We present the use cases, the overall process, and its instantiation for each language. The presenta- tion focuses on providing concrete examples for engineering steps, outcomes, and challenges. It also provides strategies for making engineering decisions.
    [Show full text]
  • Javaedge Setup and Installation
    APPENDIX A ■ ■ ■ JavaEdge Setup and Installation Throughout the book, we have used the example application, JavaEdge, to provide a practical demonstration of all the features discussed. In this appendix, we will walk you through setting up the tools and applications required to build and run JavaEdge, as well as take you through the steps needed to get the JavaEdge application running on your platform. Environment Setup Before you can get started with the JavaEdge application, you need to configure your platform to be able to build and run JavaEdge. Specifically, you need to configure Apache Ant in order to build the JavaEdge application and package it up for deployment. In addition, the JavaEdge application is designed to run on a J2EE application server and to use MySQL as the back-end database. You also need to have a current JDK installed; the JavaEdge application relies on JVM version 1.5 or higher, so make sure your JDK is compatible. We haven’t included instruc- tions for this here, since we are certain that you will already have a JDK installed if you are reading this book. However, if you do need to download one, you can find it at http://java. sun.com/j2se/1.5.0/download.jsp. Installing MySQL The JavaEdge application uses MySQL as the data store for all user, story, and comment data. If you don’t already have the MySQL database server, then you need to obtain the version applicable to your platform. You can obtain the latest production binary release of MySQL for your platform at http://www.mysql.com.
    [Show full text]
  • Java Web Frameworks Which One to Choose?
    Java Web Frameworks Which One to Choose? Mohamadou Nassourou Department of Computer Philology & Modern German Literature University of Würzburg Am Hubland D - 97074 Würzburg [email protected] Abstract This article discusses web frameworks that are available to a software developer in Java language. It introduces MVC paradigm and some frameworks that implement it. The article presents an overview of Struts, Spring MVC, JSF Frameworks, as well as guidelines for selecting one of them as development environment. 1. Introduction Over the last decade, the number of Java Web Frameworks has considerably increased. There are basically two types of Java Web Frameworks: component oriented frameworks and action based ones. Action frameworks are mainly focussing on request/response processing. Action frameworks are very procedural with little reusability of code/components. Component frameworks focus on object oriented web design. They do not concentrate on request/response processing. There exist several actions frameworks among them Struts and Spring MVC that I am going to present. I will introduce Java Server Faces (JSF) which is a component framework. All the frameworks that will be presented follow Model-View-Controller design pattern. 2. Model-View-Controller (MVC) Model-View-Controller design pattern helps developers to better organise their program's code. In fact it provides a way of separating user interface i.e View from the business logic i.e Model. A Controller is responsible for invoking appropriate pages according to user's request. It determines also what business logic to call for a given request. Practically JSP pages represent the view and servlets the controller.
    [Show full text]